#include <cstdint>
#include <iostream>
#include <stdint.h>
using namespace std;
class Solution {
public:
  uint32_t reverseBits(uint32_t n) {
    if (n == 0)
      return 0;
    uint32_t res = 0;
    int count = 31;
    while (n != 0) {
      if (n & 1) {
        res = res | (1 << count);
      }
      --count;
      n = n >> 1;
    }
    return res;
  }
};

int main() {
  uint32_t a = 4294967293;
  cout << Solution().reverseBits(a) << endl;
	unsigned int b = -1;
	cout<<b<<endl;
}
